package cn.edu.sjtu.se.dslab.dao;

import java.io.Serializable;
import java.util.List;

import cn.edu.sjtu.se.dslab.action.bean.PageBean;
import cn.edu.sjtu.se.dslab.exception.DBException;

public interface IBaseDao<T extends Serializable> {

	// public T loadObject(String hql);

	public void delById(Class<T> clazz, long id);

	public void delete(T t);
	
	public void save(T t);

	public T update(T t);

	public T queryById(Class<T> clazz, long id);

	public PageBean<T> queryByHqlForPage(int pageNum, int pageSize, String clazz)
			throws DBException;

	public PageBean<T> queryByspecialHqlForPage(int pageNum, int pageSize, String hql)
			throws DBException;
	
	/**
	 * query objects of clazz
	 * 
	 * @param clazz
	 * @return
	 */
	public List<T> queryList(String clazz);

	public List<T> queryList(int pageNo, int pageSize, String clazz);

	public long countAll(String clazz, short status, String columnName);

	/**
	 * query objects according to the condition
	 * 
	 * @param hql
	 * @return
	 */
	public List<T> query(String hql);

	/**
	 * query object according to the condition
	 * 
	 * @param hql
	 * @return
	 */
	public T queryObject(String hql);

	/**
	 * query objects
	 * 
	 * @param pageNo
	 * @param pageSize
	 * @param hql
	 * @return
	 */
	public List<T> querySpecialList(int pageNo, int pageSize, String hql);

	public List<T> querySpecialListByDate(int pageNo, int pageSize, String hql,
			String dateName);

}
